<?php

/**
 * General settings page for proroles and studentactivities
 * @package uniCRM
 * @version 1.0b
 */

session_start();

// Configuration file
include 'configuration.php';
// Functions
include 'inc/functions.php';

// Checking if user is logged in
if (!CheckSession()):
	header('Location: index.php');
	exit();
endif;

// Include all objects
foreach (glob($configuration['webroot'].'objects/*.php') as $class) { include_once $class; }

// ---------- START: HEAD
include $configuration['webroot'].'inc/head.php';
// ---------- END: HEAD

// ---------- START: MENU
include $configuration['webroot'].'inc/menu.php';
// ---------- END: MENU

// ---------- START: BODY ?>

<form action="" method ="post" class="form-crud">

<?php
// ProRole's part
$prorole = new ProRole();
$proroleList = $prorole->GetList(); ?>
<h3 class="subtitle">Rôles professionnels</h3>
<table cellpadding="0" cellspacing="0" border="0" class="table-objects" id="table-proroles">
	<?php foreach ($proroleList as $prorole) {
		$res  = '<tr>';
		$res .= '<td class="del"><a href="'.$prorole->proroleId.'" class="delete-doc delete-prorole"><img src="css/img/bin_empty.png" alt="Delete" /></a></td>';
		$res .= '<td>'.$prorole->name.'</td>';
		$res .= '</tr>';
		echo $res;
	} ?>
	<tr>
		<td class="form-crud-label"><a href="#" id="prorole-add" class="new">Ajouter :</a></td>
		<td class="form-crud-input"><input id="prorole-name" type="text" name="prorole-name" /></td>
		<td class="form-crud-label"></td>
		<td class="form-crud-input"></td>
	</tr>
</table>

<?php
// StudentActivities's part
$studentactivity = new StudentActivity();
$studentactivityList = $studentactivity->GetList(); ?>
<h3 class="subtitle">Rôles universitaires</h3>
<table cellpadding="0" cellspacing="0" border="0" class="table-objects" id="table-studentactivities">
	<?php foreach ($studentactivityList as $studentactivity) {
		$res  = '<tr>';
		$res .= '<td class="del"><a href="'.$studentactivity->studentactivityId.'" class="delete-doc delete-studentactivity"><img src="css/img/bin_empty.png" alt="Delete" /></a></td>';
		$res .= '<td>'.$studentactivity->name.'</td>';
		$res .= '</tr>';
		echo $res;
	} ?>
	<tr>
		<td class="form-crud-label"><a href="#" id="studentactivity-add" class="new">Ajouter :</a></td>
		<td class="form-crud-input"><input id="studentactivity-name" type="text" name="studentactivity-name" /></td>
		<td class="form-crud-label"></td>
		<td class="form-crud-input"></td>
	</tr>
</table>

</form>

<?php
// ---------- END: BODY

// ---------- START: FOOT
include $configuration['webroot'].'inc/foot.php';
// ---------- END: FOOT

// ---------- JAVASCRIPTS AND END
include $configuration['webroot'].'inc/js.php'; ?>
<script type="text/javascript" src="js/settings.js"></script>

</body>
</html>